Release 10.1A: OpenEdge Development:
Progress Dynamics Basic Development
Defining TreeView nodes
This section provides step-by-step instructions for working through the
DepartmentTreeView example. It also explains the elements of the dynamic TreeView. Figure 9–2 shows a picture of what you are building so you can better understand the following pieces as you create them:Figure 9–2: Completed example TreeView
![]()
To build the descriptions and learn what they are for and how they relate:
As shown in Figure 9–2, the three-level
Departmentexample requires you to define a total of five tree nodes. As you build a TreeView there is a node to represent the set of records at the next level down, and then another node to represent the individual records at that new node. So, you will define nodes for each of the following records:Because each tree node defines both data at a certain level within the tree and also its relationship to the next level up, you must define a distinct node for each combination of a type of object or data that will be displayed at a level, and its relationship to the next level up. You will define a node for
Departmentswith no parent relationship, because that will be the top of this TreeView. TheEmployeenodes will define themselves specifically as being forEmployeesof aDepartment, and theFamilynodes asFamilyof anEmployee. Other types of relationships forEmployeesorFamilyMemberswould require you to define new nodes.Figure 9–3 shows an example of the Tree Node Maintenance frame.
Figure 9–3: Tree Node Maintenance frame
![]()
Continuing the Department example
To complete the
Departmentexample, you must define four more tree nodes, alternating data and text nodes. The next node down fromDepartmentis a text node that just displays the label Employees. It acts as a header for the individual Employee nodes of the selected Department.
![]()
To add the node:
- Save the Department node.
- Choose Add in the Tree Node Control window, then follow these steps:
- For the Node Code, type EmployeeTx (format is currently limited to ten characters).
- For the Parent Node Code, type Department, the node you defined earlier.
- For the Node Label, type Employees.
- For the Data Source Type, select Plain Text.
- For the text to be displayed next to the node, select Employees.
- The Primary SDO names the same SDO used by the level above, the one that will be providing key values to the next node down. For the Primary SDO, type departmefullo.
This node will not launch a container window on the right side because it does not show individual record values. So, none of the remaining fields apply, except for the Image File Names, which would normally be the same choices as for any other node.
- Save this node, then choose Add again.
- Follow these steps to define the node for
Employeerecords:
- For the Node code, type Employee.
- For the Parent Node Code, type EmployeeTx.
- For the Node Label, type Employee.
- For the Data Source Type, select SDO/SBO.
- For both the Data Source and Primary SDO, select employeefullo.
- For the Launch Container, select the name of the window defined for Employee maintenance, EmployeeFoldWin.
- To display the employee’s last name next to the node, type &1 for the Node Label Expression and Employee.LastName for the Label Text Substitution.
Because this node uses the
Departmenttable as a parent, you list the Foreign Fields that define the foreign key relationship. Note that because the EmployeeTx text node is placed in between the Department data node and the Employee data node, that intervening EmployeeTx node repeats the name of the parentDatasource. It is then the next node down, the Employee node, that actually defines the foreign key relationship between the parent and itself.- For the Foreign Fields value, type Employee.DeptCode,DeptCode.
- Save this node, then choose Add again.
- Follow these steps to define another Text node that goes between Employee and Family:
- Save this node, then choose Add again.
- Follow these steps to define the Family data node:
- For the Node Code, type Family.
- For the Parent Node Code, type FamilyTxt.
- For the Node Label, type Family Member.
- For the Data Source Type, select SDO/SBO.
- For the Data Source and Primary SDO, enter familyfullo.
- For the Launch Container, type FamilyFoldWin.
- For the Node Label Expression, type &1.
- For the Label Text Substitution, type Family.RelativeName to display the name of family member.
- For the Foreign Fields, type Family.EmpNum, EmpNum.
- Save each of the tree nodes in turn, then exit the Tree Node Control.
Once you have defined all the tree nodes needed by a TreeView window, you can define the window itself.
Note: These tree nodes define a particular hierarchy. Each node level defines its relationship to the next level above. Thus, to define a different TreeView window using some of the same tables, you must define a new set of tree nodes.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |